.block.block-themed.animated.fadeIn
  .block-header.bg-success
    ul.block-options
      li
        a data-placement="left" data-toggle="tooltip" href="/login" title='已有账号？点击登陆'
          | 直接登陆 &nbsp;
          i.si.si-login
    h3.block-title = @html_title
  .block-content.block-content-full.block-content-narrow
    h1.h2.font-w600.push-30-t.push-5 创建账号
    p 请填写您的企业和管理员账号信息
    form.js-validation-register.form-horizontal.push-50-t.push-50 action="/register" method="post" data-remote='true'
      .form-group
        .col-xs-8
          .form-material.form-material-success
            input#register-mobile.form-control.code-mobile name="mobile" placeholder=("请输入您的手机号") type="text" /
            label for="register-mobile"  手机号
        .col-xs-4
          = button_tag '获取验证码', class: 'btn btn-default get_code', data: {code_type: 1}
      .form-group
        .col-xs-12
          .form-material.form-material-success
            input#register-code.form-control name="code" placeholder=("请输入收到的验证码") /
            label for="register-code" 验证码
      .form-group
        .col-xs-12
          .form-material.form-material-success
            input#register-customer-name.form-control name="customer_name" placeholder=("请填写您的企业全名") /
            label for="register-customer-name" 企业名
      .form-group
        .col-xs-12
          .form-material.form-material-success
            input#register-user-name-cn.form-control name="name_cn" placeholder=("请输入您的姓名") /
            label for="register-user-name-cn" 您的姓名

      .form-group
        .col-xs-12
          .form-material.form-material-success
            input#register-password.form-control name="password" placeholder=("请输入您的密码") type="password" /
            label for="register-password"  登陆密码
      .form-group
        .col-xs-12
          .form-material.form-material-success
            input#register-password2.form-control name="password2" placeholder=("请重复您的密码") type="password" /
            label for="register-password2"  密码确认

      .form-group
        .col-xs-12.col-sm-6.col-md-5
          button.btn.btn-block.btn-success type="submit"
            i.fa.fa-plus.pull-right
            | 提交注册
javascript:
  jQuery('.js-validation-register').validate({
    errorClass: 'help-block text-right animated fadeInDown',
    errorElement: 'div',
    errorPlacement: function (error, e) {
      jQuery(e).parents('.form-group > div').append(error);
    },
    highlight: function (e) {
      jQuery(e).closest('.form-group').removeClass('has-error').addClass('has-error');
      jQuery(e).closest('.help-block').remove();
    },
    success: function (e) {
      jQuery(e).closest('.form-group').removeClass('has-error');
      jQuery(e).closest('.help-block').remove();
    },
    rules: {
      'mobile': {
        required: true,
        rangelength: [11, 11]
      },
      'code': {
        required: true,
        rangelength: [4, 4],
        remote: {
          url: "/validate_code",
          type: "put",
          data: {
            type: 1,
            mobile: function () {
              return $('#register-mobile').val()
            }
          }
        }
      },
      'customer_name': {
        required: true,
        minlength: 3
      },
      'password': {
        required: true,
        minlength: 5
      },
      'password2': {
        required: true,
        equalTo: '#register-password'
      }
    },
    messages: {
      'mobile': {
        required: '请输入您的手机号',
        rangelength: '请输入正确的手机号'
      },
      'code': {
        required: '请输入您收到的验证码',
        rangelength: '请输入您收到的4位验证码',
        remote: '您输入的验证码不正确！'
      },
      'password': {
        required: '请输入您的新密码',
        minlength: '密码长度不能少于5位'
      },
      'password2': {
        required: '请重复输入您的新密码',
        equalTo: '请输入跟上面一致的密码'
      }
    }
  });